package io.renren.modules.generator.service.impl;

import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.generator.dao.TestProjectDao;
import io.renren.modules.generator.entity.TestProjectEntity;
import io.renren.modules.generator.service.TestProjectService;

@Service("testProjectService")
public class TestProjectServiceImpl extends ServiceImpl<TestProjectDao, TestProjectEntity>
        implements TestProjectService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        // 获取前端传过来待查询的参数，除了页数等，还有传进来待查询的项目名称
        String projectName = (String) params.get("projectName");
        IPage<TestProjectEntity> page = this.page(new Query<TestProjectEntity>().getPage(params),
                new QueryWrapper<TestProjectEntity>().like(StringUtils.isNotBlank(projectName), "project_name",
                        projectName));

        return new PageUtils(page);
    }

}